SLES 12
Sponsored Link

Configure NFS Client
2015/11/21
 
This example is based on the environment below.
+----------------------+          |          +----------------------+
| [    NFS Server    ] |10.0.0.30 | 10.0.0.31| [    NFS Client    ] |
|     dlp.srv.world    +----------+----------+     www.srv.world    |
|                      |                     |                      |
+----------------------+                     +----------------------+

[1] Configure NFS Client.
www:~ #
zypper -n install nfs-client
www:~ #
vi /etc/idmapd.conf
# line 5: uncomment and change to your domain name

Domain =
srv.world
www:~ #
mount -t nfs dlp.srv.world:/home /home

www:~ #
df -hT

Filesystem             Type      Size  Used Avail Use% Mounted on
/dev/vda2              btrfs      13G  5.0G  6.8G  43% /
devtmpfs               devtmpfs  1.9G     0  1.9G   0% /dev
tmpfs                  tmpfs     1.9G     0  1.9G   0% /dev/shm
tmpfs                  tmpfs     1.9G  9.6M  1.9G   1% /run
tmpfs                  tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/vda2              btrfs      13G  5.0G  6.8G  43% /.snapshots
/dev/vda2              btrfs      13G  5.0G  6.8G  43% /var/tmp
...
...
/dev/vda2              btrfs      13G  5.0G  6.8G  43% /var/lib/pgsql
/dev/vda2              btrfs      13G  5.0G  6.8G  43% /var/spool
dlp.srv.world:/home nfs4       16G   32M   16G   1% /home
# home directory from NFS server is mounted
[2] Configure NFS mounting on fstab to mount it when the system boots.
www:~ #
vi /etc/fstab
# add NFS mount's settings to the end

dlp.srv.world:/home /home                     nfs     defaults 0 0
[3] Configure auto-mounting. For example, set NFS directory on /mntdir.
www:~ #
zypper -n install autofs
www:~ #
vi /etc/auto.master
# add follows to the end

/-    /etc/auto.mount

www:~ #
vi /etc/auto.mount
# create new : [mount point] [option] [location]

/mntdir -fstype=nfs,rw  dlp.srv.world:/home

www:~ #
mkdir /mntdir

www:~ #
systemctl start autofs

www:~ #
systemctl enable autofs

# move to the mount point to make sure it normally mounted

www:~ #
cd /mntdir

www:/mntdir #
total 0
drwxr-xr-x 7 suse users 238 Nov 19 16:25 suse

www:/mntdir #
cat /proc/mounts | grep mntdir

/etc/auto.mount /mntdir autofs rw,relatime,fd=7,pgrp=1581,timeout=600,minproto=5,maxproto=5,direct 0 0
dlp.srv.world:/home /mntdir nfs4 rw,relatime,vers=4.0,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,
port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.0.0.31,local_lock=none,addr=10.0.0.30 0 0
 
Tweet